apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'

group='com.github.seven332'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 24
        versionCode 13
        versionName "0.1.12"

        externalNativeBuild {
            ndkBuild {
                abiFilters "armeabi-v7a"
            }
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    externalNativeBuild{
        ndkBuild{
            path "src/main/jni/Android.mk"
        }
    }
}

task javah(type: Exec, dependsOn: 'compileReleaseJavaWithJavac') {
    commandLine 'javah', '-jni',
            '-d', 'src/main/jni/image',
            '-cp', "${android.getSdkDirectory().getAbsolutePath()}/platforms/android-23/android.jar;build/intermediates/classes/release",
            'com.hippo.image.Image',
            'com.hippo.image.StaticImage',
            'com.hippo.image.StaticDelegateImage',
            'com.hippo.image.AnimatedImage',
            'com.hippo.image.AnimatedDelegateImage'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:support-annotations:24.2.0'
    testCompile 'junit:junit:4.12'
}

// build a jar with source files
task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    failOnError  false
    source = android.sourceSets.main.java.sourceFiles
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    classpath += configurations.compile
}

// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives sourcesJar
    archives javadocJar
}
